home *** CD-ROM | disk | FTP | other *** search
- /*---------------------------------------------------------------------------*\
- | CtlHTML DemoView.cpp - CtlHTML(tm) Control Library Test Program |
- | Windmill Point Software, Alburg, VT 05440 |
- | Copyright (c) 1999, Windmill Point Software |
- | All Rights Reserved. |
- \*---------------------------------------------------------------------------*/
-
- #include "stdafx.h"
- #include "CtlHTML Demo.h"
- #include "CtlHTML DemoDoc.h"
- #include "CtlHTML DemoView.h"
- #include "..\CtlHtml.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CCtlHTMLDemoView
-
- IMPLEMENT_DYNCREATE(CCtlHTMLDemoView, CFormView)
-
- BEGIN_MESSAGE_MAP(CCtlHTMLDemoView, CFormView)
- //{{AFX_MSG_MAP(CCtlHTMLDemoView)
- ON_WM_SIZE()
- //}}AFX_MSG_MAP
- ON_WM_CTLCOLOR()
- END_MESSAGE_MAP()
-
- CCtlHTMLDemoView::CCtlHTMLDemoView()
- : CFormView(CCtlHTMLDemoView::IDD)
- {
- //{{AFX_DATA_INIT(CCtlHTMLDemoView)
- //}}AFX_DATA_INIT
- }
-
- CCtlHTMLDemoView::~CCtlHTMLDemoView()
- {
- }
-
- void CCtlHTMLDemoView::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CCtlHTMLDemoView)
- //}}AFX_DATA_MAP
- }
-
- BOOL CCtlHTMLDemoView::PreCreateWindow(CREATESTRUCT& cs)
- {
- return CFormView::PreCreateWindow(cs);
- }
-
- void CCtlHTMLDemoView::OnInitialUpdate()
- {
- CFormView::OnInitialUpdate();
- // GetParentFrame()->RecalcLayout();
- // ResizeParentToFit();
-
- CWnd *pStatic;
- CRect clientRect, controlRect;
- CSize controlSize;
-
- // adjust the text control size to be the width of the parent dialog, minus the border
- if ((pStatic = GetDlgItem(IDC_TEXT)) != 0)
- {
- GetWindowRect(&clientRect);
- pStatic->GetWindowRect(&controlRect);
- controlSize.cx = clientRect.Width() - 2 * (controlRect.left - clientRect.left);
- controlSize.cy = clientRect.Height() - 2 * (controlRect.top - clientRect.top);
- pStatic->SetWindowPos(0, 0, 0, controlSize.cx, controlSize.cy, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
- }
-
- // subclass the dialog
- CtlHTMLSubclassDialog(m_hWnd);
- }
-
- HBRUSH CCtlHTMLDemoView::OnCtlColor (CDC *pDC, CWnd *pWnd, UINT nCtlColor)
- {
- return GetSysColorBrush(COLOR_WINDOW);
- }
-
- void CCtlHTMLDemoView::OnSize(UINT nType, int cx, int cy)
- {
- CFormView::OnSize(nType, cx, cy);
-
- CWnd *pStatic;
- CRect clientRect, controlRect;
- CSize controlSize;
-
- // adjust the text control size to be the width of the parent dialog, minus the border
- if ((pStatic = GetDlgItem(IDC_TEXT)) != 0)
- {
- GetWindowRect(&clientRect);
- pStatic->GetWindowRect(&controlRect);
- controlSize.cx = clientRect.Width() - 2 * (controlRect.left - clientRect.left);
- controlSize.cy = clientRect.Height() - 2 * (controlRect.top - clientRect.top);
- pStatic->SetWindowPos(0, 0, 0, controlSize.cx, controlSize.cy, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOZORDER);
- pStatic->GetClientRect(&controlRect);
- }
- }
-
- #ifdef _DEBUG
-
- void CCtlHTMLDemoView::AssertValid() const
- {
- CFormView::AssertValid();
- }
-
- void CCtlHTMLDemoView::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
-
- CCtlHTMLDemoDoc* CCtlHTMLDemoView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCtlHTMLDemoDoc)));
- return (CCtlHTMLDemoDoc*)m_pDocument;
- }
-
- #endif //_DEBUG
-
-